package com.andnnl.pool;

import com.andnnl.pool.retry.DelayMsRetryFilter;
import com.andnnl.pool.retry.FixedRetryFilter;

/**
 * Created by chenss on 2021/8/2.
 */
public class RetryFactory {

    /**
     * 固定时长延迟重试
     * @param tryTimes 重试次数
     * @param delayMs 固定延迟秒数(毫秒)
     * @return
     */
    public static IRetryMsgFilter build(int tryTimes, long delayMs){
        return new FixedRetryFilter(tryTimes,delayMs);
    }

    /**
     * 自定义延迟时长重试
     * @param delayMs 延迟时长列表(毫秒)
     * @return
     */
    public static IRetryMsgFilter build(long... delayMs){
        return new DelayMsRetryFilter(delayMs);
    }
}
